Skip to content

一、概述

Kibana 是一款开源的数据分析和可视化平台,它是 Elastic Stack 成员之一,设计用于和 Elasticsearch 协作。您可以使用 Kibana 对 Elasticsearch 索引中的数据进行搜索、查看、交互操作。您可以很方便的利用图表、表格及地图对数据进行多元化的分析和呈现。 官网:https://www.elastic.co/cn/products/kibana

1.1 功能说明

image-20210124212555230

二、使用示例

三、仪表盘

3.1 Metricbeat 仪表盘

将Metricbeat的数据在Kibana中展示。

#修改metricbeat配置
setup.kibana:
host: "192.168.1.7:5601"
#安装仪表盘到Kibana
./metricbeat setup --dashboards

3.2 Filebeat 仪表盘

以Redis为例:

yml
#修改配置文件
filebeat.inputs:
- type: log
enabled: true
paths:
- /haoke/log/*.log
setup.template.settings:
index.number_of_shards: 3
filebeat.config.modules:
path: ${path.config}/modules.d/*.yml
reload.enabled: false
output.elasticsearch:
hosts: ["192.168.1.7:9200","192.168.1.7:9201","192.168.1.7:9202"]
setup.kibana:
host: "192.168.1.7:5601"
#安装仪表盘到kibana
./filebeat -c haoke-redis.yml setup

在kibana中已经看到了Filebeat中的redis仪表盘。

yml
#修改配置文件 vim itcast-nginx.yml 
filebeat.inputs: 
#- type: log 
# enabled: true 


<NolebasePageProperties />




# paths: 
# - /usr/local/nginx/logs/*.log 
# tags: ["nginx"] 

setup.template.settings: 
	index.number_of_shards: 3 
output.elasticsearch: 
	hosts: ["192.168.40.133:9200","192.168.40.134:9200","192.168.40.135:9200"] 
filebeat.config.modules: 
	path: ${path.config}/modules.d/*.yml 
	reload.enabled: false 
setup.kibana: 
	host: "192.168.40.133:5601" 

#安装仪表盘到kibana
./filebeat -c itcast-nginx.yml setup

四、安装

4.1 普通安装

  1. 下载

  2. 解压

    sh
    tar -xvf kibana-6.5.4-linux-x86_64.tar.gz
  3. 配置

    sh
    #修改配置文件
    vim config/kibana.yml
    server.host: "192.168.1.7" #对外暴露服务的地址
    elasticsearch.url: "http://192.168.1.7:9200" #配置Elasticsearch
  4. 启动

    sh
    ./bin/kibana
  5. 访问

    sh
    #通过浏览器进行访问
    http://192.168.1.7:5601/app/kibana

4.2 通过docker部署

sh
#1. 拉取镜像
docker pull kibana:6.5.4
#2. 创建配置文件
vim kibana.yml
server.host: "192.168.1.7"
elasticsearch.url: "http://192.168.1.7:9200"
#3. 创建容器 #设置设置elasticsearch的地址
docker create --name kibana --net host -v /haoke/beats/kibanadocker/
-e ELASTICSEARCH_HOSTS=http://es:9200 \
kibana.yml:/usr/share/kibana/config/kibana.yml kibana:6.5.4
#4.启动容器
docker logs -f kibana